﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="panel.aspx.cs" Inherits="SinavSistemi.panel" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="css/style.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
        
        <div class="merkez" style="margin-top:100px;"><img src="images/logo_(1)png.png" />
            <h2 style="color:indigo;"><% Response.Write("Sayin "+Session["username"]+",\r\n Aşağıda uygulayabileceginiz sinavlar mevcuttur"); %></h2>
            <table>
             
                <%
                    // buraya tarih degisimi yapiyoruz
                    string buguntarih = SinavSistemi.Class.dateunit.sadecetarih();
                    int id = Convert.ToInt32(Session["userID"]);
                    int durum = 0;
                    System.Data.SqlClient.SqlConnection sqlcon = SinavSistemi.Class.connection.baglanti;
                    System.Data.SqlClient.SqlCommand sqlcmd = new System.Data.SqlClient.SqlCommand("select * from uygulanamalar as u inner join sinavlar as s on u.sinavID=s.sinavID where userID=@userid and durum=0 and enddate >= @tarih", sqlcon);
                    sqlcmd.Parameters.AddWithValue("@userid", id);
                    sqlcmd.Parameters.AddWithValue("@tarih", buguntarih);

                    sqlcon.Open();
                    System.Data.SqlClient.SqlDataReader sdr = sqlcmd.ExecuteReader();

                    while (sdr.Read())
                    {
                        Session["sorusayisi"] = sdr["sorusayisi"].ToString();
                        
                        Response.Write(" <tr style='font-family:Arial; font-size:large;'>");
                        Response.Write("<td>  " + sdr["sinavismi"].ToString() + " </td>");
                        Response.Write("<td>  <a href='sinavhazirla.aspx?sinavID=" + sdr["sinavID"].ToString() + "&soruID=1&userID=" + Session["userID"].ToString() + "' >Sinavi Baslat</a> </td>");
                        Response.Write("</tr>");
                        durum = 1;
                    }

                    if (durum == 0)
                    {
                        Response.Write(" Adiniza Kayitli Bir Sinav Bulunmamaktadir");
                    }





                    sqlcon.Close();
                
                %>
            </table>
        </div>
    </form>
</body>
</html>
